package com.seafwg.anno.dao.impl;

import com.seafwg.anno.dao.AccountDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @Author seafwg
 * @Date 2022/3/13 1:07 上午
 * @Version 1.0
 * @description xxx
 */
@Repository
public class AccountDaoImpl implements AccountDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public void addAccount(String addPerson, int money) {
        jdbcTemplate.update("update account set money = money + ? where name = ?", money, addPerson);
    }

    @Override
    public void divAccount(String divPerson, int money) {
        jdbcTemplate.update("update account set money = money - ? where name = ?", money, divPerson);
    }
}
